
import SwiftUI

struct SpeedDialView: View {
    @State var kv = [(String, String)]()

    var body: some View {
        List {
            ForEach(kv, id: \.1, content: { row in
                HStack {
                    Text(row.0)
                    Spacer()
                    Text(row.1)
                }
            })
        }.onAppear(perform: {
                if let array = NSArray(contentsOfFile: speeddialPath) as? [[String: Any]] {
                    for dict in array {
                        if let name = dict["Name"] as? String, let value = dict["Value"] as? String {
                            kv.append((name, value))
                        }
                    }
                }
        })
    }
}

struct SpeedDialView_Previews: PreviewProvider {
    static var previews: some View {
        SpeedDialView()
    }
}
